<?php


namespace App\Job;



class Dispatcher
{
    protected $job;

    protected $queue = 'default';

    public function __construct(IJob $job)
    {
        $this->job = $job;
    }

    public function onQueue($queue)
    {
        $this->queue = $queue;
        return $this;
    }

    public function __destruct()
    {
        \ioc(QueueContract::class)->dispatch($this->queue, $this->job);
    }

}